home *** CD-ROM | disk | FTP | other *** search
- Date: Mon, 20 Jan 1997 12:25:15 +0000 (GMT)
- From: Philip Blundell <pjb27@cam.ac.uk>
- X-Sender: pjb27@hammer.thor.cam.ac.uk
- To: Joseph Heenan <esuvf@csv.warwick.ac.uk>
- Cc: linux-arm@vger.rutgers.edu
- Subject: Re: Arm Linux
- In-Reply-To: <28500.199701201213@lupin.csv.warwick.ac.uk>
- Message-Id: <Pine.SOL.3.95.970120121454.7874E-100000@hammer.thor.cam.ac.uk>
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- Sender: owner-linux-arm@vger.rutgers.edu
- Precedence: bulk
-
- On Mon, 20 Jan 1997, Joseph Heenan wrote:
-
- > Perhaps I've got the wrong end of the stick here - I'd assumed
- > debian would be a lot of C sources that just need perhaps the odd
- > bit of inline assembler rewriting. Surely the C compiler should handle
- > all the platform specific things, apart from inline assembler?
-
- No. To take a contrived example, imagine you have this:
-
- unsigned char foo[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- unsigned int *bar;
-
- bar = (unsigned int *)(foo+1);
- printf("bar = %08x\n", *bar);
-
- On Intel, this gives:
-
- kings-cross:~$ ./align
- bar = 05040302
- kings-cross:~$
-
- On Alpha, this gives:
-
- paddington:~$ ./align
- align(1964): unaligned trap at 0000000120000a74: 000000011ffff711 28 2
- bar = 05040302
- paddington:~$
-
- But on an old ARM, you will get `bar = 0x04030201'. The reason is that
- the dereference of `bar' compiles to an LDR instruction. In general, the
- compiler can't know the alignment at compile-time, so there's not a lot
- else it *can* do. Old ARM machines silently discard the low two address
- bits when you ask them to do a word access. This differs, as I said
- before, from the Intel (where you get the correct access performed, albeit
- more slowly) and the Alpha/SPARC/etc (where you get a fault, and your OS
- has to patch up in software).
-
- This sort of thing doesn't crop up *that* often, but it does happen, and
- code will go wrong when it does. There is *very* little inline assembler
- in most things, and I doubt much porting work will be needed in general.
- A lot of autoconf scripts will probably need to be taught about Linux/ARM,
- but other than that...
-
- > Basic sounds like quite a good idea. Shame it's copyright, really -
- > a basic interpretter running under general unix has some sort of appeal
- > to it :-)
-
- Yes. OTOH, although it's copyright, if it's in ROM it can be used fairly
- freely. Someone sufficiently sick could probably write a snippet of code
- to be run as root that rummages around the RISC OS ROMs and pulls out the
- BASIC module.
-
- P.
-
-